package com.qianyue.享元模式;

import java.util.HashMap;
import java.util.Map;

/**
 * box形状
 *
 * @author qian yue
 * @version v1.0.0
 * @since 2025/2/4 15:43
 */
public class BoxFactory {
    private Map<String, AbstractBox> boxMap;

    private static final BoxFactory BOX_FACTORY = new BoxFactory();

    private BoxFactory() {
        boxMap = new HashMap<>();
        boxMap.put("O", new OBox());
        boxMap.put("L", new LBox());
        boxMap.put("I", new IBox());
    }

    public static BoxFactory getInstance() {
        return BOX_FACTORY;
    }
    public AbstractBox getBox(String type) {
        return boxMap.get(type);
    }
}
